home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_bind.idb / usr / freeware / src / bind / patches.z / patches
Encoding:
Text File  |  1999-04-16  |  57.2 KB  |  2,157 lines

  1. *** ./bin/dig/Makefile    Wed Jun 18 20:22:07 1997
  2. --- ../src/./bin/dig/Makefile    Tue Feb  9 12:32:42 1999
  3. ***************
  4. *** 40,46 ****
  5.   STRIP=-s
  6.   
  7.   LDFLAGS=
  8. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL}
  9.   
  10.   NSLOOKUP_OBJS= \
  11.       ../nslookup/subr.${O} ../nslookup/send.${O} \
  12. --- 40,46 ----
  13.   STRIP=-s
  14.   
  15.   LDFLAGS=
  16. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL}  ${CPPFLAGS}
  17.   
  18.   NSLOOKUP_OBJS= \
  19.       ../nslookup/subr.${O} ../nslookup/send.${O} \
  20. ***************
  21. *** 63,69 ****
  22.       rm -f *.BAK *.CKP *~ *.orig
  23.   
  24.   depend: ${SRCS}
  25. !     mkdep -p ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${SRCS}
  26.   
  27.   ${DESTDIR}${DESTBIN}:
  28.       mkdir -p ${DESTDIR}${DESTBIN}
  29. --- 63,69 ----
  30.       rm -f *.BAK *.CKP *~ *.orig
  31.   
  32.   depend: ${SRCS}
  33. !     mkdep -p -I${INCL} -I${PORTINCL} ${CPPFLAGS} ${SRCS}
  34.   
  35.   ${DESTDIR}${DESTBIN}:
  36.       mkdir -p ${DESTDIR}${DESTBIN}
  37. *** ./bin/addr/Makefile    Wed Jun 18 20:22:06 1997
  38. --- ../src/./bin/addr/Makefile    Tue Feb  9 12:32:31 1999
  39. ***************
  40. *** 40,46 ****
  41.   STRIP=-s
  42.   
  43.   LDFLAGS=
  44. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL}
  45.   
  46.   PROG= addr
  47.   SRCS= ${PROG}.c
  48. --- 40,46 ----
  49.   STRIP=-s
  50.   
  51.   LDFLAGS=
  52. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL}  ${CPPFLAGS}
  53.   
  54.   PROG= addr
  55.   SRCS= ${PROG}.c
  56. ***************
  57. *** 59,65 ****
  58.       rm -f *.BAK *.CKP *~ *.orig
  59.   
  60.   depend: ${SRCS}
  61. !     mkdep -p ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${SRCS}
  62.   
  63.   ${DESTDIR}${DESTBIN}:
  64.       mkdir -p ${DESTDIR}${DESTBIN}
  65. --- 59,65 ----
  66.       rm -f *.BAK *.CKP *~ *.orig
  67.   
  68.   depend: ${SRCS}
  69. !     mkdep -p -I${INCL} -I${PORTINCL}  ${CPPFLAGS} ${SRCS}
  70.   
  71.   ${DESTDIR}${DESTBIN}:
  72.       mkdir -p ${DESTDIR}${DESTBIN}
  73. *** ./bin/nsupdate/Makefile    Wed Jun 18 20:22:11 1997
  74. --- ../src/./bin/nsupdate/Makefile    Tue Feb  9 12:32:21 1999
  75. ***************
  76. *** 40,46 ****
  77.   STRIP=-s
  78.   
  79.   LDFLAGS=
  80. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL}
  81.   
  82.   PROG= nsupdate
  83.   SRCS= ${PROG}.c
  84. --- 40,46 ----
  85.   STRIP=-s
  86.   
  87.   LDFLAGS=
  88. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL} ${CPPFLAGS}
  89.   
  90.   PROG= nsupdate
  91.   SRCS= ${PROG}.c
  92. ***************
  93. *** 59,65 ****
  94.       rm -f *.BAK *.CKP *~ *.orig
  95.   
  96.   depend: ${SRCS}
  97. !     mkdep -p ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${SRCS}
  98.   
  99.   ${DESTDIR}${DESTBIN}:
  100.       mkdir -p ${DESTDIR}${DESTBIN}
  101. --- 59,65 ----
  102.       rm -f *.BAK *.CKP *~ *.orig
  103.   
  104.   depend: ${SRCS}
  105. !     mkdep -p -I${INCL} -I${PORTINCL} ${CPPFLAGS} ${SRCS}
  106.   
  107.   ${DESTDIR}${DESTBIN}:
  108.       mkdir -p ${DESTDIR}${DESTBIN}
  109. *** ./bin/host/Makefile    Wed Jun 18 20:22:08 1997
  110. --- ../src/./bin/host/Makefile    Tue Feb  9 12:28:22 1999
  111. ***************
  112. *** 40,46 ****
  113.   STRIP=-s
  114.   
  115.   LDFLAGS=
  116. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL}
  117.   
  118.   PROG= host
  119.   SRCS= ${PROG}.c
  120. --- 40,46 ----
  121.   STRIP=-s
  122.   
  123.   LDFLAGS=
  124. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL} ${CPPFLAGS}
  125.   
  126.   PROG= host
  127.   SRCS= ${PROG}.c
  128. ***************
  129. *** 59,65 ****
  130.       rm -f *.BAK *.CKP *~ *.orig
  131.   
  132.   depend: ${SRCS}
  133. !     mkdep -p ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${SRCS}
  134.   
  135.   ${DESTDIR}${DESTBIN}:
  136.       mkdir -p ${DESTDIR}${DESTBIN}
  137. --- 59,65 ----
  138.       rm -f *.BAK *.CKP *~ *.orig
  139.   
  140.   depend: ${SRCS}
  141. !     mkdep -p -I${INCL} -I${PORTINCL} ${CPPFLAGS} ${SRCS}
  142.   
  143.   ${DESTDIR}${DESTBIN}:
  144.       mkdir -p ${DESTDIR}${DESTBIN}
  145. *** ./bin/dnsquery/Makefile    Wed Jun 18 20:22:08 1997
  146. --- ../src/./bin/dnsquery/Makefile    Tue Feb  9 12:27:46 1999
  147. ***************
  148. *** 40,46 ****
  149.   STRIP=-s
  150.   
  151.   LDFLAGS=
  152. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL}
  153.   
  154.   PROG= dnsquery
  155.   SRCS= ${PROG}.c
  156. --- 40,46 ----
  157.   STRIP=-s
  158.   
  159.   LDFLAGS=
  160. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL} ${CPPFLAGS}
  161.   
  162.   PROG= dnsquery
  163.   SRCS= ${PROG}.c
  164. ***************
  165. *** 59,65 ****
  166.       rm -f *.BAK *.CKP *~ *.orig
  167.   
  168.   depend: ${SRCS}
  169. !     mkdep -p ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${SRCS}
  170.   
  171.   ${DESTDIR}${DESTBIN}:
  172.       mkdir -p ${DESTDIR}${DESTBIN}
  173. --- 59,65 ----
  174.       rm -f *.BAK *.CKP *~ *.orig
  175.   
  176.   depend: ${SRCS}
  177. !     mkdep -p -I${INCL} -I${PORTINCL} ${CPPFLAGS} ${SRCS}
  178.   
  179.   ${DESTDIR}${DESTBIN}:
  180.       mkdir -p ${DESTDIR}${DESTBIN}
  181. *** ./bin/named-xfer/Makefile    Mon Apr 13 17:39:03 1998
  182. --- ../src/./bin/named-xfer/Makefile    Tue Feb  9 12:27:11 1999
  183. ***************
  184. *** 43,49 ****
  185.   
  186.   PS=ps
  187.   LDFLAGS=
  188. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL}
  189.   
  190.   NAMED_OBJS= \
  191.       ../named/db_glue.${O} ../named/ns_glue.${O} ../named/tmp_version.${O}
  192. --- 43,49 ----
  193.   
  194.   PS=ps
  195.   LDFLAGS=
  196. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL} ${CPPFLAGS}
  197.   
  198.   NAMED_OBJS= \
  199.       ../named/db_glue.${O} ../named/ns_glue.${O} ../named/tmp_version.${O}
  200. ***************
  201. *** 65,71 ****
  202.       rm -f *.BAK *.CKP *~ *.${O} *.orig
  203.   
  204.   depend: ${SRCS}
  205. !     mkdep -p ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${SRCS}
  206.   
  207.   ${DESTDIR}${DESTEXEC}:
  208.       mkdir -p ${DESTDIR}${DESTEXEC}
  209. --- 65,71 ----
  210.       rm -f *.BAK *.CKP *~ *.${O} *.orig
  211.   
  212.   depend: ${SRCS}
  213. !     mkdep -p -I${INCL} -I${PORTINCL} ${CPPFLAGS} ${SRCS}
  214.   
  215.   ${DESTDIR}${DESTEXEC}:
  216.       mkdir -p ${DESTDIR}${DESTEXEC}
  217. *** ./bin/named-xfer/named-xfer.c    Thu Mar 26 16:19:28 1998
  218. --- ../src/./bin/named-xfer/named-xfer.c    Tue Feb  9 11:39:31 1999
  219. ***************
  220. *** 143,148 ****
  221. --- 143,158 ----
  222.   #include <isc/eventlib.h>
  223.   #include <isc/logging.h>
  224.   
  225. + #ifdef _TRUSTED_IRIX
  226. + #include <cap_net.h>        /* cap_bind() */
  227. + #include <sys/mac.h>        /* tsix_set_mac_byrhost(), mac_t,
  228. +                  * tsix_set_solabel()
  229. +                  */
  230. + #include <sys/t6net.h>        /* tsix_set_mac_byrhost(), mac_t,
  231. +                  * tsix_set_solabel()
  232. +                  */
  233. + #endif    /* #ifdef _TRUSTED_IRIX */
  234.   #include "port_after.h"
  235.   
  236.   #define MAIN_PROGRAM
  237. ***************
  238. *** 673,681 ****
  239. --- 683,700 ----
  240.               sin.sin_addr = zp->z_axfr_src;
  241.               dprintf(2, "binding to address [%s]\n",
  242.                   inet_ntoa(sin.sin_addr));
  243. + #ifdef _TRUSTED_IRIX
  244. +             if (cap_bind(s, (struct sockaddr *)&sin, sizeof sin)\
  245. +                 < 0)
  246. +                     syslog(LOG_INFO,\
  247. +                        "warning: cap_bind(%s) failed",
  248. +                        inet_ntoa(zp->z_axfr_src));
  249. + #else    /* #ifdef _TRUSTED_IRIX */
  250.               if (bind(s, (struct sockaddr *)&sin, sizeof sin) < 0)
  251.                   syslog(LOG_INFO, "warning: bind(%s) failed",
  252.                          inet_ntoa(zp->z_axfr_src));
  253. + #endif    /* #ifdef _TRUSTED_IRIX #else */
  254.           }
  255.           memset(&sin, 0, sizeof sin);
  256.           sin.sin_family = AF_INET;
  257. ***************
  258. *** 683,689 ****
  259. --- 702,719 ----
  260.           sin.sin_addr = zp->z_addr[cnt];
  261.           dprintf(2, "connecting to server #%d [%s].%d\n",
  262.               cnt+1, inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
  263. + #ifdef _TRUSTED_IRIX
  264. +         /* 
  265. +          * Set MAC label of all outgoing comm and the socket to default
  266. +          * remote MAC label.
  267. +          */
  268. +         if ( ((app_tsix_set_connect_mac(s,&sin) < 0)\
  269. +               ||\
  270. +               (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)) )
  271. +         {
  272. + #else    /* #ifdef _TRUSTED_IRIX */
  273.           if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
  274. + #endif    /* #ifdef _TRUSTED_IRIX */
  275.               if (!quiet)
  276.                   syslog(LOG_INFO,
  277.                          "connect(%s) for zone %s failed: %m",
  278. *** ./bin/named/ns_req.c    Thu Mar 26 16:21:03 1998
  279. --- ../src/./bin/named/ns_req.c    Tue Feb  9 11:39:31 1999
  280. ***************
  281. *** 143,153 ****
  282. --- 143,162 ----
  283.                   u_int16_t, u_int16_t);
  284.   static void        copyCharString(u_char **, const char *);
  285.   
  286. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  287.   static enum req_action    req_query(HEADER *hp, u_char **cpp, u_char *eom,
  288.                     struct qstream *qsp,
  289.                     int *buflenp, int *msglenp,
  290.                     u_char *msg, int dfd,
  291. +                   struct sockaddr_in from,
  292. +                   req_info * request_info);
  293. + #else    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  294. + static enum req_action    req_query(HEADER *hp, u_char **cpp, u_char *eom,
  295. +                   struct qstream *qsp,
  296. +                   int *buflenp, int *msglenp,
  297. +                   u_char *msg, int dfd,
  298.                     struct sockaddr_in from);
  299. + #endif    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else */
  300.   
  301.   static enum req_action    req_iquery(HEADER *hp, u_char **cpp, u_char *eom,
  302.                      int *buflenp, u_char *msg,
  303. ***************
  304. *** 161,169 ****
  305. --- 170,184 ----
  306.   /*
  307.    * Process request using database; assemble and send response.
  308.    */
  309. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  310.   void
  311.   ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
  312. +        struct sockaddr_in from, int dfd, req_info * request_info)
  313. + #else    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  314. + void
  315. + ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
  316.          struct sockaddr_in from, int dfd)
  317. + #endif    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else */
  318.   {
  319.       HEADER *hp = (HEADER *) msg;
  320.       u_char *cp, *eom;
  321. ***************
  322. *** 195,203 ****
  323. --- 210,225 ----
  324.   
  325.       switch (hp->opcode) {
  326.       case ns_o_query:
  327. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  328. +         action = req_query(hp, &cp, eom, qsp,
  329. +                    &buflen, &msglen,
  330. +                    msg, dfd, from,
  331. +                    request_info);
  332. + #else /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  333.           action = req_query(hp, &cp, eom, qsp,
  334.                      &buflen, &msglen,
  335.                      msg, dfd, from);
  336. + #endif/* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else */
  337.           break;
  338.   
  339.       case ns_o_iquery:
  340. ***************
  341. *** 265,273 ****
  342. --- 287,309 ----
  343.           fp_nquery(msg, cp - msg, log_get_stream(packet_channel));
  344.   #endif /*DEBUG*/
  345.       if (qsp == NULL) {
  346. + #ifdef _USE_ONE_SOCKET_PER_PROTO
  347. + #ifdef _TRUSTED_IRIX
  348. +         if (sendfromto(dfd, (char*)msg, cp - msg, 0,\
  349. +                    &(request_info->to_addr),\
  350. +                    (struct sockaddr *)&from,\
  351. +                    sizeof(*from), request_info->from_label) < 0) {
  352. + #else    /* #ifdef _TRUSTED_IRIX */
  353. +         if (sendfromto(dfd, (char*)msg, cp - msg, 0,\
  354. +                    &(request_info->to_addr),\
  355. +                    (struct sockaddr *)&from,\
  356. +                    sizeof(*from)) < 0) {
  357. + #endif    /* #ifdef _TRUSTED_IRIX */
  358. + #else    /* #ifdef _USE_ONE_SOCKET_PER_PROTO */
  359.           if (sendto(dfd, (char*)msg, cp - msg, 0,
  360.                  (struct sockaddr *)&from,
  361.                  sizeof(from)) < 0) {
  362. + #endif    /* #ifdef _USE_ONE_SOCKET_PER_PROTO */
  363.               if (!haveComplained(ina_ulong(from.sin_addr),
  364.                           (u_long)sendtoStr))
  365.                   ns_info(ns_log_default,
  366. ***************
  367. *** 409,418 ****
  368. --- 445,461 ----
  369.   }
  370.   #endif /*BIND_NOTIFY*/
  371.   
  372. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  373.   static enum req_action
  374.   req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
  375.         int *buflenp, int *msglenp, u_char *msg, int dfd,
  376. +       struct sockaddr_in from, req_info * request_info)
  377. + #else    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  378. + static enum req_action
  379. + req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
  380. +       int *buflenp, int *msglenp, u_char *msg, int dfd,
  381.         struct sockaddr_in from)
  382. + #endif    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else */
  383.   {
  384.       int n, class, type, count, zone, foundname, founddata, omsglen, cname;
  385.       u_int16_t id;
  386. ***************
  387. *** 905,912 ****
  388. --- 948,962 ----
  389.           }
  390.           *msglenp = n;
  391.       }
  392. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  393.       n = ns_forw(nsp, msg, *msglenp, from, qsp, dfd, &qp,
  394. +             dname, class, type, np, 0, request_info);
  395. + #else    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  396. +     n = ns_forw(nsp, msg, *msglenp, from, qsp, dfd, &qp,
  397.               dname, class, type, np, 0);
  398. + #endif    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else */
  399.       if (n != FW_OK && cname)
  400.           memput(omsg, omsglen);
  401.       switch (n) {
  402. ***************
  403. *** 1587,1592 ****
  404. --- 1637,1646 ----
  405.               /* ask a real server for this info */
  406.               (void) sysquery(ap->a_dname, (int)ap->a_class, T_A,
  407.                       NULL, 0, QUERY);
  408. + #ifdef IPv6_ENHANCEMENT
  409. +                (void) sysquery(ap->a_dname, (int)ap->a_class, T_AAAA,
  410. +                     NULL, 0, QUERY);
  411. + #endif    /* #ifdef IPv6_ENHANCEMENT */
  412.           }
  413.           if (foundcname) {
  414.               if (!haveComplained(nhash(ap->a_dname),
  415. *** ./bin/named/ns_resp.c    Mon Mar 16 11:40:07 1998
  416. --- ../src/./bin/named/ns_resp.c    Tue Feb  9 11:39:31 1999
  417. ***************
  418. *** 122,127 ****
  419. --- 122,132 ----
  420.   #include <isc/logging.h>
  421.   #include <isc/memcluster.h>
  422.   
  423. + #ifdef _TRUSTED_IRIX
  424. + #include <sys/mac.h>        /* tsix_set_mac_byrhost() */
  425. + #include <sys/t6net.h>        /* tsix_set_mac_byrhost() */
  426. + #endif    /* #ifdef _TRUSTED_IRIX */
  427.   #include "port_after.h"
  428.   
  429.   #include "named.h"
  430. ***************
  431. *** 1380,1386 ****
  432.                       "ns_forw: tcp_send(%s) failed: %s",
  433.                       sin_ntoa(*nsa), strerror(errno));
  434.           }
  435. !     } else if (sendto(ds, (char*)qp->q_msg, qp->q_msglen, 0,
  436.              (struct sockaddr *)nsa,
  437.              sizeof(struct sockaddr_in)) < 0)
  438.       {
  439. --- 1385,1395 ----
  440.                       "ns_forw: tcp_send(%s) failed: %s",
  441.                       sin_ntoa(*nsa), strerror(errno));
  442.           }
  443. !     } else if ( 
  444. ! #ifdef _TRUSTED_IRIX
  445. !         tsix_set_mac_byrhost (ds, &nsa->sin_addr, NULL) ||
  446. ! #endif    /* #ifdef _TRUSTED_IRIX */
  447. !         sendto(ds, (char*)qp->q_msg, qp->q_msglen, 0,
  448.              (struct sockaddr *)nsa,
  449.              sizeof(struct sockaddr_in)) < 0)
  450.       {
  451. ***************
  452. *** 1925,1933 ****
  453. --- 1934,1956 ----
  454.           fp_nquery(msg, msglen, log_get_stream(packet_channel));
  455.   #endif /* DEBUG */
  456.       if (qp->q_stream == NULL) {
  457. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  458. + #ifdef _TRUSTED_IRIX
  459. +         if (sendfromto(qp->q_dfd, (char*)msg, msglen, 0,
  460. +                &qp->q_to, (struct sockaddr *)&qp->q_from,
  461. +                sizeof(qp->q_from), qp->q_label) < 0) {
  462. + #else    /* #ifdef _TRUSTED_IRIX */
  463. +         if (sendfromto(qp->q_dfd, (char*)msg, msglen, 0,
  464. +                &qp->q_to, (struct sockaddr *)&qp->q_from,
  465. +                sizeof(qp->q_from)) < 0) {
  466. + #endif    /* #ifdef _TRUSTED_IRIX #else */
  467. + #else    /* #ifdef _USE_ONE_SOCKET_PER_PROTOCOL */
  468.           if (sendto(qp->q_dfd, (char*)msg, msglen, 0,
  469.                  (struct sockaddr *)&qp->q_from,
  470.                  sizeof(qp->q_from)) < 0) {
  471. + #endif    /* #ifdef _USE_ONE_SOCKET_PER_PROTOCOL #else */
  472.               if (!haveComplained(ina_ulong(qp->q_from.sin_addr),
  473.                           (u_long)sendtoStr))
  474.   #if defined(SPURIOUS_ECONNREFUSED)
  475. ***************
  476. *** 2324,2330 ****
  477.           fp_nquery(qp->q_msg, qp->q_msglen,
  478.                 log_get_stream(packet_channel));
  479.   #endif
  480. !     if (sendto(qp->q_dfd, (char*)qp->q_msg, qp->q_msglen, 0,
  481.              (struct sockaddr *)nsa,
  482.              sizeof(struct sockaddr_in)) < 0) {
  483.           if (!haveComplained(ina_ulong(nsa->sin_addr),
  484. --- 2347,2357 ----
  485.           fp_nquery(qp->q_msg, qp->q_msglen,
  486.                 log_get_stream(packet_channel));
  487.   #endif
  488. !     if (
  489. ! #ifdef _TRUSTED_IRIX
  490. !         tsix_set_mac_byrhost (qp->q_dfd, &nsa->sin_addr, NULL) ||
  491. ! #endif    /* #ifdef _TRUSTED_IRIX */
  492. !         sendto(qp->q_dfd, (char*)qp->q_msg, qp->q_msglen, 0,
  493.              (struct sockaddr *)nsa,
  494.              sizeof(struct sockaddr_in)) < 0) {
  495.           if (!haveComplained(ina_ulong(nsa->sin_addr),
  496. *** ./bin/named/ns_defs.h    Mon Apr 13 17:35:09 1998
  497. --- ../src/./bin/named/ns_defs.h    Tue Feb  9 11:39:31 1999
  498. ***************
  499. *** 72,77 ****
  500. --- 72,81 ----
  501.    * SOFTWARE.
  502.    */
  503.   
  504. + #ifdef _TRUSTED_IRIX
  505. + #include <sys/mac.h>
  506. + #endif    /* #ifdef _TRUSTED_IRIX */
  507.   /*
  508.    * Global definitions for the name server.
  509.    */
  510. ***************
  511. *** 202,207 ****
  512. --- 206,232 ----
  513.           } \
  514.       } while (0)
  515.   
  516. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  517. + /* Structure used to pass requestor's target address and its MAC 
  518. +  * label.
  519. +  */
  520. + typedef struct _req_info {
  521. + #ifdef _TRUSTED_IRIX
  522. +     mac_t        from_label;    /* MAC label of requestor node */
  523. + #endif    /* #ifdef _TRUSTED_IRIX */
  524. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  525. +     struct in_addr    to_addr;    /* Target or destination address
  526. +                      * used by requestor.
  527. +                      */
  528. + #endif    /* #ifdef _USE_ONE_SOCKET_PER_PROTOCOL */
  529. + } req_info;
  530. + #endif    /*#if defined(_USE_ONE_SOCKET_PER_PROTOCOL)*/
  531.   enum severity { ignore, warn, fail, not_set };
  532.   
  533.   enum znotify { znotify_use_default=0, znotify_yes, znotify_no };
  534. ***************
  535. *** 350,355 ****
  536. --- 375,389 ----
  537.       u_int16_t    q_nsid;        /* id of forwarded query */
  538.       struct sockaddr_in
  539.               q_from;        /* requestor's address */
  540. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  541. +     struct in_addr    q_to;        /* their idea of our address */
  542. + #endif    /* #ifdef _USE_ONE_SOCKET_PER_PROTOCOL */
  543. + #ifdef _TRUSTED_IRIX
  544. +     mac_t        q_label;    /* requestor's mac label */
  545. + #endif    /* #ifdef _TRUSTED_IRIX */
  546.       u_char        *q_msg,        /* the message */
  547.               *q_cmsg;    /* the cname message */
  548.       int16_t        q_msglen,    /* len of message */
  549. *** ./bin/named/ns_func.h    Thu Mar 19 16:53:44 1998
  550. --- ../src/./bin/named/ns_func.h    Tue Feb  9 11:39:31 1999
  551. ***************
  552. *** 136,142 ****
  553. --- 136,146 ----
  554.   extern void        ns_req(u_char *, int, int,
  555.                      struct qstream *,
  556.                      struct sockaddr_in,
  557. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  558. +                    int, req_info *),
  559. + #else    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  560.                      int),
  561. + #endif    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else */
  562.               free_addinfo(void),
  563.               free_nsp(struct databuf **);
  564.   extern int        stale(struct databuf *),
  565. ***************
  566. *** 174,180 ****
  567. --- 178,188 ----
  568.                   int class,
  569.                   int type,
  570.                   struct namebuf *np,
  571. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  572. +                 int use_tcp, req_info * request_info),
  573. + #else    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  574.                   int use_tcp),
  575. + #endif    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else */
  576.               haveComplained(u_long, u_long),
  577.               nslookup(struct databuf *nsp[],
  578.                    struct qinfo *qp,
  579. *** ./bin/named/Makefile    Thu Mar 19 16:49:46 1998
  580. --- ../src/./bin/named/Makefile    Tue Feb  9 12:26:08 1999
  581. ***************
  582. *** 44,50 ****
  583.   
  584.   PS=ps
  585.   LDFLAGS=
  586. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL} ${DEFS}
  587.   
  588.   VER= LOCAL-`date +%y%m%d.%H%M%S`
  589.   HOSTNAMECMD= hostname || uname -n
  590. --- 44,50 ----
  591.   
  592.   PS=ps
  593.   LDFLAGS=
  594. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL} ${DEFS} ${CPPFLAGS}
  595.   
  596.   VER= LOCAL-`date +%y%m%d.%H%M%S`
  597.   HOSTNAMECMD= hostname || uname -n
  598. ***************
  599. *** 106,112 ****
  600.       rm -f y.tab.h y.tab.c
  601.   
  602.   depend: ${SRCS} pathnames.h
  603. !     mkdep ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${DEFS} ${SRCS}
  604.   
  605.   ${DESTDIR}${DESTSBIN}:
  606.       mkdir -p ${DESTDIR}${DESTSBIN}
  607. --- 106,112 ----
  608.       rm -f y.tab.h y.tab.c
  609.   
  610.   depend: ${SRCS} pathnames.h
  611. !     mkdep -I${INCL} -I${PORTINCL} ${CPPFLAGS} ${DEFS} ${SRCS}
  612.   
  613.   ${DESTDIR}${DESTSBIN}:
  614.       mkdir -p ${DESTDIR}${DESTSBIN}
  615. *** ./bin/named/ns_main.c    Tue Apr 28 12:17:46 1998
  616. --- ../src/./bin/named/ns_main.c    Tue Feb  9 11:39:31 1999
  617. ***************
  618. *** 126,131 ****
  619. --- 126,135 ----
  620.   #include <isc/memcluster.h>
  621.   #include <isc/list.h>
  622.   
  623. + #ifdef _TRUSTED_IRIX
  624. + #include <cap_net.h>    /* cap_bind() */
  625. + #endif
  626.   #include "port_after.h"
  627.   
  628.   #ifdef HAVE_GETRUSAGE        /* XXX */
  629. ***************
  630. *** 171,177 ****
  631. --- 175,186 ----
  632.                   dispatch_message(u_char *, int, int,
  633.                            struct qstream *,
  634.                            struct sockaddr_in, int,
  635. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  636. +                          interface *,
  637. +                          req_info *);
  638. + #else    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  639.                            interface *);
  640. + #endif    /*#if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else*/
  641.   static void            stream_send(evContext, void *, int,
  642.                              const void *, int,
  643.                              const void *, int);
  644. ***************
  645. *** 873,880 ****
  646. --- 882,894 ----
  647.   
  648.       nameserIncr(sp->s_from.sin_addr, nssRcvdTCP);
  649.       sq_query(sp);
  650. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  651.       dispatch_message(sp->s_buf, bytes, sp->s_bufsize, sp, sp->s_from, -1,
  652. +              sp->s_ifp, NULL);
  653. + #else    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  654. +     dispatch_message(sp->s_buf, bytes, sp->s_bufsize, sp, sp->s_from, -1,
  655.                sp->s_ifp);
  656. + #endif    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else */
  657.   }
  658.   
  659.   static void
  660. ***************
  661. *** 887,896 ****
  662. --- 901,929 ----
  663.           HEADER h;            /* Force alignment of 'buf'. */
  664.           u_char buf[PACKETSZ+1];
  665.       } u;
  666. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  667. +     req_info    request_info;        /* Used to pass information
  668. +                          *  about incoming requests.
  669. +                          */
  670. +      n = recvfromto(fd, (char *)u.buf, sizeof u.buf, 0,
  671. +             (struct sockaddr *)&from, from_len
  672. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  673. +             , &(request_info.to_addr)
  674. + #ifdef _TRUSTED_IRIX
  675. +             , &(request_info.from_label)
  676. + #endif    /* #ifdef _TRUSTED_IRIX */
  677. + #endif    /* #ifdef _USE_ONE_SOCKET_PER_PROTOCOL */
  678. +          );
  679. + #else    /*#if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  680.   
  681.       n = recvfrom(fd, (char *)u.buf, sizeof u.buf, 0,
  682.                (struct sockaddr *)&from, &from_len);
  683.   
  684. + #endif    /*#if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else*/
  685.       if (n < 0) {
  686.           switch (errno) {
  687.           case EINTR:
  688. ***************
  689. *** 950,961 ****
  690. --- 983,1008 ----
  691.       }
  692.   
  693.       gettime(&tt);        /* Keep 'tt' current. */
  694. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  695. +     dispatch_message(u.buf, n, PACKETSZ, NULL, from, fd, ifp,\
  696. +              &request_info);
  697. + #else
  698.       dispatch_message(u.buf, n, PACKETSZ, NULL, from, fd, ifp);
  699. + #endif    /*#if defined(_USE_ONE_SOCKET_PER_PROTOCOL)*/
  700.   }
  701.   
  702. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  703.   static void
  704.   dispatch_message(u_char *msg, int msglen, int buflen, struct qstream *qsp,
  705. +          struct sockaddr_in from, int dfd, interface *ifp, 
  706. +          req_info * request_info)
  707. + #else
  708. + static void
  709. + dispatch_message(u_char *msg, int msglen, int buflen, struct qstream *qsp,
  710.            struct sockaddr_in from, int dfd, interface *ifp)
  711. + #endif
  712.   {
  713.       HEADER *hp = (HEADER *)msg;
  714.   
  715. ***************
  716. *** 971,977 ****
  717. --- 1018,1028 ----
  718.           if (needs_prime_cache)
  719.               prime_cache();
  720.       } else if (ifp != NULL)
  721. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX)
  722. +         ns_req(msg, msglen, buflen, qsp, from, dfd, request_info);
  723. + #else    /*#if defined(_USE_ONE_SOCKET_PER_PROTOCOL)*/
  724.           ns_req(msg, msglen, buflen, qsp, from, dfd);
  725. + #endif    /*#if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else*/
  726.       else {
  727.           ns_notice(ns_log_security,
  728.                 "refused query on non-query socket from %s",
  729. ***************
  730. *** 996,1001 ****
  731. --- 1047,1055 ----
  732.       ip_match_element ime;
  733.       u_char *mask_ptr;
  734.       struct in_addr mask;
  735. + #ifdef _USE_ONE_SOCKET_PER_PROTO
  736. +     int    first_iter = 1;
  737. + #endif
  738.   
  739.       ns_debug(ns_log_default, 1, "getnetconf(generation %lu)",
  740.            (u_long)my_generation);
  741. ***************
  742. *** 1024,1030 ****
  743. --- 1078,1092 ----
  744.   
  745.       ifc.ifc_len = sizeof buf;
  746.       ifc.ifc_buf = buf;
  747. + #ifdef IRIX_EMUL_IOCTL_SIOCGIFCONF
  748. +     /* This is a fix for IRIX OS in which the call to ioctl with the flag
  749. +      * SIOCGIFCONF may not return an entry for all the interfaces like
  750. +      * most falvors of Unix.
  751. +      */
  752. +     if (emul_ioctl(&ifc) < 0)
  753. + #else
  754.       if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0)
  755. + #endif
  756.           ns_panic(ns_log_default, 1, "get interface configuration: %s",
  757.                strerror(errno));
  758.   
  759. ***************
  760. *** 1069,1074 ****
  761. --- 1131,1149 ----
  762.           }
  763.           ina = ina_get((u_char *)&((struct sockaddr_in *)
  764.                          &ifreq.ifr_addr)->sin_addr);
  765. + #ifdef _USE_ONE_SOCKET_PER_PROTO
  766. +         if ( first_iter && !periodic_scan ) {
  767. +             /* Do not open generic sockets if this is a periodic
  768. +              * scan they are already open.
  769. +              */
  770. +             ina.sin_family = AF_INET;
  771. +             ina.sin_addr.s_addr = INADDR_ANY;
  772. +             
  773. +         }
  774. + #endif    /* #ifdef _USE_ONE_SOCKET_PER_PROTO */
  775.           ns_debug(ns_log_default, 1,
  776.                "getnetconf: considering %s [%s]",
  777.                ifreq.ifr_name, inet_ntoa(ina));
  778. ***************
  779. *** 1076,1086 ****
  780. --- 1151,1165 ----
  781.            * Don't test IFF_UP, packets may still be received at this
  782.            * address if any other interface is up.
  783.            */
  784. + #ifndef _USE_ONE_SOCKET_PER_PROTO
  785.           if (ina_hlong(ina) == INADDR_ANY) {
  786.               ns_debug(ns_log_default, 2,
  787.                    "getnetconf: INADDR_ANY, ignoring.");
  788.               continue;
  789.           }
  790. + #endif
  791.   
  792.           INSIST(server_options != NULL);
  793.           INSIST(server_options->listen_list != NULL);
  794. ***************
  795. *** 1122,1127 ****
  796. --- 1201,1224 ----
  797.                   ifp->flags = 0;
  798.                   ifp->dfd = -1;
  799.                   ifp->sfd = -1;
  800. + #ifdef _USE_ONE_SOCKET_PER_PROTO
  801. +                 if ( first_iter ) {
  802. +                     /* Open only INADDR_ANY or generic sockets
  803. +                      */
  804. +                     if (opensocket_d(ifp) < 0 ||
  805. +                     opensocket_s(ifp) < 0) {
  806. +                     dq_remove(ifp);
  807. +                     found = 0;
  808. +                     break;
  809. +                     }
  810. +                     cp -= cpsize;
  811. +                     first_iter = 0;
  812. +                 }/* if ( first_iter ) */        
  813. + #else    /* #ifdef _USE_ONE_SOCKET_PER_PROTO */
  814.                   if (opensocket_d(ifp) < 0 ||
  815.                       opensocket_s(ifp) < 0) {
  816.                       dq_remove(ifp);
  817. ***************
  818. *** 1128,1133 ****
  819. --- 1225,1232 ----
  820.                       found = 0;
  821.                       break;
  822.                   }
  823. + #endif    /* #ifdef _USE_ONE_SOCKET_PER_PROTO #else */
  824.                   ns_info(ns_log_default,
  825.                       "listening on [%s].%u (%s)",
  826.                       inet_ntoa(ina), ntohs(li->port),
  827. ***************
  828. *** 1270,1275 ****
  829. --- 1369,1382 ----
  830.                strerror(errno));
  831.           return (-1);
  832.       }
  833. + #ifdef _TRUSTED_IRIX
  834. +     if (tsix_on(ifp->dfd) == -1) {
  835. +         ns_error(ns_log_default, "tsix_on(s=%d): %s", ifp->dfd,
  836. +              strerror(errno));
  837. +     }
  838. + #endif    /* #ifdef _TRUSTED_IRIX */
  839.   #ifdef F_DUPFD        /* XXX */
  840.       /*
  841.        * Leave a space for stdio to work in.
  842. ***************
  843. *** 1307,1317 ****
  844. --- 1414,1461 ----
  845.           /* XXX press on regardless, this is not too serious. */
  846.       }
  847.   #endif
  848. + #ifdef _USE_ONE_SOCKET_PER_PROTO
  849. +     /*
  850. +      * The IP_RECVDSTADDR option allows us to receive the IP destination
  851. +      * address with the request so that we can turn around and send the
  852. +      * packet as if it came from that address.  This is a workaround
  853. +      * for connected UDP and IP aliases.
  854. +      */
  855. +     if (setsockopt(ifp->dfd, IPPROTO_IP, IP_RECVDSTADDR,\
  856. +                (char *)&on, sizeof(on)) != 0) {
  857. +         /* Can't operate in this mode if this fails! */
  858. +         ns_error(ns_log_default, "setsockopt(dfd=%d): %s", ifp->dfd,\
  859. +              strerror(errno));
  860. +         return (-1);
  861. +     }
  862. + #endif    /* #ifdef _USE_ONE_SOCKET_PER_PROTO */
  863. + #ifdef _TRUSTED_IRIX
  864. +     if (cap_bind(ifp->dfd, (struct sockaddr *)&nsa, sizeof nsa)) {
  865. +         ns_error(ns_log_default, "cap_bind(dfd=%d, %s): %s",
  866. +              ifp->dfd, sin_ntoa(nsa), strerror(errno));
  867. +         return (-1);
  868. +     }
  869. + #else    /* #ifdef _TRUSTED_IRIX */
  870.       if (bind(ifp->dfd, (struct sockaddr *)&nsa, sizeof nsa)) {
  871.           ns_error(ns_log_default, "bind(dfd=%d, %s): %s",
  872.                ifp->dfd, sin_ntoa(nsa), strerror(errno));
  873.           return (-1);
  874.       }
  875. + #endif    /* #ifdef _TRUSTED_IRIX #else */
  876.       if (evSelectFD(ev, ifp->dfd, EV_READ, datagram_read, ifp,
  877.                  &ifp->evID_d) == -1) {
  878.           ns_error(ns_log_default, "evSelectFD(dfd=%d): %s",
  879. ***************
  880. *** 1367,1373 ****
  881. --- 1511,1522 ----
  882.                 strerror(errno));
  883.           /* Consider that your first warning of trouble to come. */
  884.       }
  885. + #ifdef _TRUSTED_IRIX
  886. +     if (cap_bind(ifp->sfd, (struct sockaddr *)&nsa, sizeof nsa) < 0) {
  887. + #else    /* #ifdef _TRUSTED_IRIX */
  888.       if (bind(ifp->sfd, (struct sockaddr *)&nsa, sizeof nsa) < 0) {
  889. + #endif    /* #ifdef _TRUSTED_IRIX #else */
  890.           if (errno != EADDRINUSE || ++n > 4) {
  891.               if (errno == EADDRINUSE)
  892.                   ns_error(ns_log_default,
  893. ***************
  894. *** 1374,1382 ****
  895. --- 1523,1537 ----
  896.                 "There may be a name server already running on %s",
  897.                        sin_ntoa(nsa));
  898.               else
  899. + #ifdef _TRUSTED_IRIX
  900. +                 ns_error(ns_log_default,
  901. +                      "cap_bind(sfd=%d, %s): %s", ifp->sfd,
  902. +                      sin_ntoa(nsa), strerror(errno));
  903. + #else
  904.                   ns_error(ns_log_default,
  905.                        "bind(sfd=%d, %s): %s", ifp->sfd,
  906.                        sin_ntoa(nsa), strerror(errno));
  907. + #endif
  908.               return (-1);
  909.           }
  910.   
  911. ***************
  912. *** 1466,1476 ****
  913. --- 1621,1640 ----
  914.                 strerror(errno));
  915.           /* XXX press on regardless, this is not too serious. */
  916.       }
  917. + #ifdef _TRUSTED_IRIX
  918. +     if (cap_bind(ds, (struct sockaddr *)&server_options->query_source,
  919. +          sizeof server_options->query_source) < 0)
  920. +         ns_panic(ns_log_default, 1, "opensocket_f: cap_bind(%s): %s",
  921. +              sin_ntoa(server_options->query_source),
  922. +              strerror(errno));
  923. + #else    /* #ifdef _TRUSTED_IRIX */
  924.       if (bind(ds, (struct sockaddr *)&server_options->query_source,
  925.            sizeof server_options->query_source) < 0)
  926.           ns_panic(ns_log_default, 1, "opensocket_f: bind(%s): %s",
  927.                sin_ntoa(server_options->query_source),
  928.                strerror(errno));
  929. + #endif    /* #ifdef _TRUSTED_IRIX #else */
  930.   
  931.       n = sizeof nsa;
  932.       if (getsockname(ds, (struct sockaddr *)&nsa, &n) < 0)
  933. *** ./bin/named/ns_forw.c    Mon Feb 23 17:02:40 1998
  934. --- ../src/./bin/named/ns_forw.c    Tue Feb  9 11:39:31 1999
  935. ***************
  936. *** 97,102 ****
  937. --- 97,108 ----
  938.   
  939.   #include "port_after.h"
  940.   
  941. + #ifdef _TRUSTED_IRIX 
  942. + #include <sys/mac.h>        /* tsix_set_mac_byrhost() */
  943. + #include <sys/t6net.h>        /* tsix_set_mac_byrhost() */
  944. + #include <sys/mac_label.h>    /* mac_dup() */
  945. + #endif    /* #ifdef _TRUSTED_IRIX  */
  946.   #include "named.h"
  947.   
  948.   struct complaint {
  949. ***************
  950. *** 122,128 ****
  951.   ns_forw(struct databuf *nsp[], u_char *msg, int msglen,
  952.       struct sockaddr_in from, struct qstream *qsp, int dfd,
  953.       struct qinfo **qpp, const char *dname, int class, int type,
  954. !     struct namebuf *np, int use_tcp)
  955.   {
  956.       struct qinfo *qp;
  957.       char tmpdomain[MAXDNAME];
  958. --- 128,139 ----
  959.   ns_forw(struct databuf *nsp[], u_char *msg, int msglen,
  960.       struct sockaddr_in from, struct qstream *qsp, int dfd,
  961.       struct qinfo **qpp, const char *dname, int class, int type,
  962. ! #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX) 
  963. !     struct namebuf *np, int use_tcp, req_info * request_info)
  964. ! #else    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  965. !     struct namebuf *np, int use_tcp )
  966. ! #endif    /* #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) #else */
  967.   {
  968.       struct qinfo *qp;
  969.       char tmpdomain[MAXDNAME];
  970. ***************
  971. *** 155,160 ****
  972. --- 166,183 ----
  973.       getname(np, tmpdomain, sizeof tmpdomain);
  974.       qp->q_domain = savestr(tmpdomain, 1);
  975.       qp->q_from = from;    /* nslookup wants to know this */
  976. + #ifdef _TRUSTED_IRIX
  977. +     /* DO WE HAVE TO DUPLICATE THIS LABEL ??? */ 
  978. +     if( request_info != NULL )
  979. +         qp->q_label = (mac_t) mac_dup((mac_label *)request_info->from_label);
  980. + #endif    /* #ifdef _TRUSTED_IRIX */
  981. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  982. +     if( request_info != NULL )
  983. +         qp->q_to = request_info->to_addr;
  984. + #endif
  985.       n = nslookup(nsp, qp, dname, "ns_forw");
  986.       if (n < 0) {
  987.           ns_debug(ns_log_default, 2, "forw: nslookup reports danger");
  988. ***************
  989. *** 220,231 ****
  990.                       "ns_forw: tcp_send(%s) failed: %s",
  991.                       sin_ntoa(*nsa), strerror(errno));
  992.           }
  993. !     } else if (sendto(ds, (char *)msg, msglen, 0, (struct sockaddr *)nsa,
  994. !            sizeof(struct sockaddr_in)) < 0) {
  995.           if (!haveComplained(ina_ulong(nsa->sin_addr),
  996.                       (u_long)sendtoStr))
  997. !             ns_info(ns_log_default, "ns_forw: sendto(%s): %s",
  998.                   sin_ntoa(*nsa), strerror(errno));
  999.           nameserIncr(nsa->sin_addr, nssSendtoErr);
  1000.       }
  1001.       if (NS_OPTION_P(OPTION_HOSTSTATS))
  1002. --- 243,265 ----
  1003.                       "ns_forw: tcp_send(%s) failed: %s",
  1004.                       sin_ntoa(*nsa), strerror(errno));
  1005.           }
  1006. !     } else if (
  1007. ! #ifdef _TRUSTED_IRIX
  1008. !         tsix_set_mac_byrhost (ds, &(nsa->sin_addr), NULL) ||
  1009. ! #endif    /* #ifdef _TRUSTED_IRIX */
  1010. !         (sendto(ds, (char *)msg, msglen, 0, (struct sockaddr *)nsa,
  1011. !            sizeof(struct sockaddr_in)) < 0)) {
  1012.           if (!haveComplained(ina_ulong(nsa->sin_addr),
  1013.                       (u_long)sendtoStr))
  1014. ! #ifdef _TRUSTED_IRIX
  1015. !             ns_info(ns_log_default,\
  1016. !                 "ns_forw: tsix_set_mac_byrhost|sendto(%s): %s",
  1017. !                 sin_ntoa(*nsa), strerror(errno));
  1018. ! #else    /* #ifdef _TRUSTED_IRIX */
  1019. !             ns_info(ns_log_default,\
  1020. !                 "ns_forw: sendto(%s): %s",
  1021.                   sin_ntoa(*nsa), strerror(errno));
  1022. + #endif    /* #ifdef _TRUSTED_IRIX #else */
  1023.           nameserIncr(nsa->sin_addr, nssSendtoErr);
  1024.       }
  1025.       if (NS_OPTION_P(OPTION_HOSTSTATS))
  1026. ***************
  1027. *** 967,975 ****
  1028.               ns_debug(ns_log_default, 3,
  1029.                    "error resending tcp msg: %s",
  1030.                    strerror(errno));
  1031. !     } else if (sendto(ds, (char*)qp->q_msg, qp->q_msglen, 0,
  1032.              (struct sockaddr *)nsa,
  1033. !            sizeof(struct sockaddr_in)) < 0)
  1034.       {
  1035.           ns_debug(ns_log_default, 3, "error resending msg: %s",
  1036.                strerror(errno));
  1037. --- 1001,1013 ----
  1038.               ns_debug(ns_log_default, 3,
  1039.                    "error resending tcp msg: %s",
  1040.                    strerror(errno));
  1041. !     } else if (
  1042. ! #ifdef _TRUSTED_IRIX
  1043. !         tsix_set_mac_byrhost (ds, &(nsa->sin_addr), NULL) ||
  1044. ! #endif    /* #ifdef _TRUSTED_IRIX */
  1045. !         (sendto(ds, (char*)qp->q_msg, qp->q_msglen, 0,
  1046.              (struct sockaddr *)nsa,
  1047. !            sizeof(struct sockaddr_in)) < 0))
  1048.       {
  1049.           ns_debug(ns_log_default, 3, "error resending msg: %s",
  1050.                strerror(errno));
  1051. *** ./bin/named/ns_update.c    Tue May  5 12:45:10 1998
  1052. --- ../src/./bin/named/ns_update.c    Tue Feb  9 11:39:31 1999
  1053. ***************
  1054. *** 892,899 ****
  1055. --- 892,905 ----
  1056.            * If the request came in over TCP, forward it over TCP
  1057.            */
  1058.           should_use_tcp = (qsp != NULL);
  1059. + #if !defined(_USE_ONE_SOCKET_PER_PROTOCOL) && !defined(_TRUSTED_IRIX)
  1060. +         /* This is broken so no problem if we take it out
  1061. +          * for the time being.
  1062. +          */
  1063.           n = ns_forw(nsp, msg, eom-msg, from, qsp, dfd, &qp,
  1064.                   dname, class, type, NULL, should_use_tcp);
  1065. + #endif    /* #if !defined(_USE_ONE_SOCKET_PER_PROTOCOL) */
  1066.           free_nsp(nsp);
  1067.           switch (n) {
  1068.               case FW_OK:
  1069. *** ./bin/nslookup/Makefile    Wed Dec  3 14:55:16 1997
  1070. --- ../src/./bin/nslookup/Makefile    Tue Feb  9 12:23:38 1999
  1071. ***************
  1072. *** 41,47 ****
  1073.   
  1074.   LDFLAGS=
  1075.   DEFS=    -D_PATH_HELPFILE=\"${DESTDIR}${DESTHELP}/nslookup.help\"
  1076. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL} ${DEFS}
  1077.   
  1078.   PROG= nslookup
  1079.   CSRCS=    main.c getinfo.c debug.c send.c skip.c list.c subr.c
  1080. --- 41,47 ----
  1081.   
  1082.   LDFLAGS=
  1083.   DEFS=    -D_PATH_HELPFILE=\"${DESTDIR}${DESTHELP}/nslookup.help\"
  1084. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL} ${DEFS} ${CPPFLAGS}
  1085.   
  1086.   PROG= nslookup
  1087.   CSRCS=    main.c getinfo.c debug.c send.c skip.c list.c subr.c
  1088. ***************
  1089. *** 64,70 ****
  1090.       rm -f lex.yy.c lex.yy.o
  1091.   
  1092.   depend: ${SRCS}
  1093. !     mkdep ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${DEFS} ${CSRCS}
  1094.   
  1095.   ${DESTDIR}${DESTHELP}:
  1096.       mkdir -p ${DESTDIR}${DESTHELP}
  1097. --- 64,70 ----
  1098.       rm -f lex.yy.c lex.yy.o
  1099.   
  1100.   depend: ${SRCS}
  1101. !     mkdep -I${INCL} -I${PORTINCL} ${CPPFLAGS} ${DEFS} ${CSRCS}
  1102.   
  1103.   ${DESTDIR}${DESTHELP}:
  1104.       mkdir -p ${DESTDIR}${DESTHELP}
  1105. *** ./bin/nslookup/getinfo.c    Thu Mar 19 11:30:55 1998
  1106. --- ../src/./bin/nslookup/getinfo.c    Tue Feb 23 10:20:47 1999
  1107. ***************
  1108. *** 199,205 ****
  1109.        * If there are no answer, n.s. or additional records
  1110.        * then return with an error.
  1111.        */
  1112. !     if (ancount == 0 && nscount == 0 && arcount == 0) {
  1113.       return (NO_INFO);
  1114.       }
  1115.   
  1116. --- 199,205 ----
  1117.        * If there are no answer, n.s. or additional records
  1118.        * then return with an error.
  1119.        */
  1120. !     if (ancount == 0 /*&& nscount == 0 && arcount == 0 */) {
  1121.       return (NO_INFO);
  1122.       }
  1123.   
  1124. *** ./lib/bsd/Makefile    Wed May 21 12:32:07 1997
  1125. --- ../src/./lib/bsd/Makefile    Tue Feb  9 12:35:41 1999
  1126. ***************
  1127. *** 54,60 ****
  1128.       ${RANLIB} ${LIBBIND}
  1129.   
  1130.   .c.${O}:
  1131. !     ${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
  1132.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1133.   
  1134.   distclean: clean
  1135. --- 54,60 ----
  1136.       ${RANLIB} ${LIBBIND}
  1137.   
  1138.   .c.${O}:
  1139. !     ${CC} ${CFLAGS} ${CPPFLAGS} -c $*.c
  1140.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1141.   
  1142.   distclean: clean
  1143. *** ./lib/irs/Makefile    Wed May 21 12:23:18 1997
  1144. --- ../src/./lib/irs/Makefile    Tue Feb  9 12:09:21 1999
  1145. ***************
  1146. *** 60,66 ****
  1147.       ${RANLIB} ${LIBBIND}
  1148.   
  1149.   .c.${O}:
  1150. !     ${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
  1151.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1152.   
  1153.   distclean: clean
  1154. --- 60,66 ----
  1155.       ${RANLIB} ${LIBBIND}
  1156.   
  1157.   .c.${O}:
  1158. !     ${CC} ${CFLAGS} ${CPPFLAGS} -c $*.c
  1159.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1160.   
  1161.   distclean: clean
  1162. *** ./lib/isc/Makefile    Wed Dec  3 14:36:08 1997
  1163. --- ../src/./lib/isc/Makefile    Tue Feb  9 12:08:56 1999
  1164. ***************
  1165. *** 54,60 ****
  1166.       ${RANLIB} ${LIBBIND}
  1167.   
  1168.   .c.${O}:
  1169. !     ${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
  1170.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1171.   
  1172.   distclean: clean
  1173. --- 54,60 ----
  1174.       ${RANLIB} ${LIBBIND}
  1175.   
  1176.   .c.${O}:
  1177. !     ${CC} ${CFLAGS} ${CPPFLAGS} -c $*.c
  1178.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1179.   
  1180.   distclean: clean
  1181. *** ./lib/isc/ev_connects.c    Fri Mar 20 15:26:22 1998
  1182. --- ../src/./lib/isc/ev_connects.c    Tue Feb  9 11:39:31 1999
  1183. ***************
  1184. *** 37,42 ****
  1185. --- 37,51 ----
  1186.   #include <isc/assertions.h>
  1187.   #include "eventlib_p.h"
  1188.   
  1189. + #ifdef _TRUSTED_IRIX
  1190. + #include <sys/mac.h>        /* tsix_set_mac_byrhost(), mac_t,
  1191. +                  * tsix_set_solabel()
  1192. +                  */
  1193. + #include <sys/t6net.h>        /* tsix_set_mac_byrhost(), mac_t,
  1194. +                  * tsix_set_solabel()
  1195. +                  */
  1196. + #endif    /* #ifdef _TRUSTED_IRIX */
  1197.   #include "port_after.h"
  1198.   
  1199.   /* Forward. */
  1200. ***************
  1201. *** 109,118 ****
  1202.           return (-1);
  1203.       }
  1204.       new->flags |= EV_CONN_SELECTED;
  1205. !     if (connect(fd, ra, ralen) < 0 &&
  1206. !         errno != EWOULDBLOCK &&
  1207. !         errno != EAGAIN &&
  1208. !         errno != EINPROGRESS) {
  1209.           int save = errno;
  1210.   
  1211.           (void) evDeselectFD(opaqueCtx, new->file);
  1212. --- 118,132 ----
  1213.           return (-1);
  1214.       }
  1215.       new->flags |= EV_CONN_SELECTED;
  1216. !     if ( ( 
  1217. ! #ifdef _TRUSTED_IRIX
  1218. !         (app_tsix_set_connect_mac(fd,(struct sockaddr_in *)ra) < 0)
  1219. !         ||
  1220. ! #endif    /* #ifdef _TRUSTED_IRIX */
  1221. !         (connect(fd, ra, ralen) < 0)) &&
  1222. !         (errno != EWOULDBLOCK)&&
  1223. !         (errno != EAGAIN) &&
  1224. !         (errno != EINPROGRESS)) {
  1225.           int save = errno;
  1226.   
  1227.           (void) evDeselectFD(opaqueCtx, new->file);
  1228. ***************
  1229. *** 232,237 ****
  1230. --- 246,266 ----
  1231.               new->fd = -1;
  1232.           } else
  1233.               new->ioErrno = 0;
  1234. + #ifdef _TRUSTED_IRIX
  1235. +         /* Set MAC to that of the connecting entity */
  1236. +         if (app_tsix_set_accept_mac( new->fd ) < 0) {
  1237. +             
  1238. +             new->ioErrno = errno;
  1239. +             (void) close(new->fd);
  1240. +             new->fd = -1;
  1241. +             
  1242. +         }
  1243. +         
  1244. + #endif    /* #ifdef _TRUSTED_IRIX */
  1245.       } else {
  1246.           new->ioErrno = errno;
  1247.           if (errno == EAGAIN || errno == EWOULDBLOCK) {
  1248. ***************
  1249. *** 265,270 ****
  1250. --- 294,312 ----
  1251.               errno = save;
  1252.               new = -1;
  1253.           }
  1254. + #ifdef _TRUSTED_IRIX
  1255. +         else if (app_tsix_set_accept_mac( new ) < 0) {
  1256. +             int save = errno;
  1257. +             
  1258. +             (void) close(new);
  1259. +             errno = save;
  1260. +             new = -1;
  1261. +             
  1262. +         }
  1263. +         
  1264. + #endif    /* #ifdef _TRUSTED_IRIX */
  1265.       } else if (errno == EAGAIN || errno == EWOULDBLOCK)
  1266.           return;
  1267.       (*conn->func)(opaqueCtx, conn->uap, new, &la, lalen, &ra, ralen);
  1268. *** ./lib/inet/Makefile    Wed May 21 12:32:07 1997
  1269. --- ../src/./lib/inet/Makefile    Tue Feb  9 12:08:31 1999
  1270. ***************
  1271. *** 53,59 ****
  1272.       ${RANLIB} ${LIBBIND}
  1273.   
  1274.   .c.${O}:
  1275. !     ${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
  1276.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1277.   
  1278.   distclean: clean
  1279. --- 53,59 ----
  1280.       ${RANLIB} ${LIBBIND}
  1281.   
  1282.   .c.${O}:
  1283. !     ${CC} ${CFLAGS}  ${CPPFLAGS} -c $*.c
  1284.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1285.   
  1286.   distclean: clean
  1287. *** ./lib/resolv/Makefile    Wed May 21 12:32:09 1997
  1288. --- ../src/./lib/resolv/Makefile    Tue Feb  9 12:06:15 1999
  1289. ***************
  1290. *** 52,58 ****
  1291.       ${RANLIB} ${LIBBIND}
  1292.   
  1293.   .c.${O}:
  1294. !     ${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
  1295.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1296.   
  1297.   distclean: clean
  1298. --- 52,58 ----
  1299.       ${RANLIB} ${LIBBIND}
  1300.   
  1301.   .c.${O}:
  1302. !     ${CC} ${CFLAGS} ${CPPFLAGS} -c $*.c
  1303.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1304.   
  1305.   distclean: clean
  1306. *** ./lib/resolv/res_update.c    Tue Mar 10 14:04:48 1998
  1307. --- ../src/./lib/resolv/res_update.c    Tue Feb 23 16:01:18 1999
  1308. ***************
  1309. *** 446,452 ****
  1310.            } /* while */
  1311.       }
  1312.   
  1313. !     _res.options |= RES_DEBUG;
  1314.       for (zptr = zgrp_start; zptr; zptr = zptr->z_next) {
  1315.   
  1316.           /* append zone section */
  1317. --- 446,453 ----
  1318.            } /* while */
  1319.       }
  1320.   
  1321. !     /* _res.options |= RES_DEBUG; */
  1322.       for (zptr = zgrp_start; zptr; zptr = zptr->z_next) {
  1323.   
  1324.           /* append zone section */
  1325. ***************
  1326. *** 465,472 ****
  1327.               fprintf(stderr, "res_mkupdate error\n");
  1328.               fflush(stderr);
  1329.               return (-1);
  1330. !         } else
  1331.               fprintf(stdout, "res_mkupdate: packet size = %d\n", n);
  1332.   
  1333.           /*
  1334.            * Override the list of NS records from res_init() with
  1335. --- 466,474 ----
  1336.               fprintf(stderr, "res_mkupdate error\n");
  1337.               fflush(stderr);
  1338.               return (-1);
  1339. !         }/* else
  1340.               fprintf(stdout, "res_mkupdate: packet size = %d\n", n);
  1341. +          */
  1342.   
  1343.           /*
  1344.            * Override the list of NS records from res_init() with
  1345. *** ./lib/nameser/Makefile    Wed May 21 12:32:08 1997
  1346. --- ../src/./lib/nameser/Makefile    Tue Feb  9 12:07:37 1999
  1347. ***************
  1348. *** 50,56 ****
  1349.       ${RANLIB} ${LIBBIND}
  1350.   
  1351.   .c.${O}:
  1352. !     ${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
  1353.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1354.   
  1355.   distclean: clean
  1356. --- 50,56 ----
  1357.       ${RANLIB} ${LIBBIND}
  1358.   
  1359.   .c.${O}:
  1360. !     ${CC} ${CFLAGS}  ${CPPFLAGS} -c $*.c
  1361.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1362.   
  1363.   distclean: clean
  1364. *** ./port/irix/include/port_after.h    Mon Apr  6 16:46:22 1998
  1365. --- ../src/./port/irix/include/port_after.h    Tue Feb  9 11:39:30 1999
  1366. ***************
  1367. *** 42,44 ****
  1368. --- 42,72 ----
  1369.    * in IRIX, this is sufficient.
  1370.    */
  1371.   #define vfork fork
  1372. + #ifdef IRIX_EMUL_IOCTL_SIOCGIFCONF
  1373. + /* This fucntion is used to emulate ioctl( SIOCGIFCONF ) in IRIX so that
  1374. +  * it will behave like in most UNIX systems returning an entry for each 
  1375. +  * IP interface. This fixes the IP aliasing problem in IRIX.
  1376. +  * The sysctl system call is used to retrieve the interface info which is
  1377. +  * the transfered to the ifconf structure returned by ioctl().
  1378. +  *
  1379. +  * File: emul_ioctl.h
  1380. +  * By: gomez@cs.purdue.edu
  1381. +  * Date: 11/02/98
  1382. +  * 
  1383. +  */
  1384. + #ifndef _EMUL_IOCTL_H_
  1385. + #define _EMUL_IOCTL_H_
  1386. + #include <net/if.h>   
  1387. +               /* struct ifconf, struct if_msghdr, struct ifa_msghdr,
  1388. +                * struct ifreq
  1389. +                */
  1390. + int emul_ioctl(       struct ifconf * ifc );
  1391. + #endif
  1392. + #endif        /* #ifdef IRIX_EMUL_IOCTL_SIOCGIFCONF */
  1393. *** ./port/irix/include/port_before.h    Fri Mar 20 16:59:55 1998
  1394. --- ../src/./port/irix/include/port_before.h    Tue Feb  9 13:49:38 1999
  1395. ***************
  1396. *** 3,7 ****
  1397. --- 3,65 ----
  1398.   #undef WANT_IRS_PW
  1399.   #undef WANT_IRS_GR
  1400.   #define SIG_FN void
  1401. + #define _USE_ONE_SOCKET_PER_PROTOCOL    /* Do not use a socket per interface */
  1402.   
  1403. + /* #define _TRUSTED_IRIX */        /* Compile trusted IRIX support */
  1404. +   
  1405. + #ifndef _APP_TSIX_H_
  1406. + #define _APP_TSIX_H_
  1407. + #ifdef _TRUSTED_IRIX
  1408. + #include <sys/types.h>        /* mac.h */
  1409. + #include <sys/mac.h>        /* tsix_get_mac(), tsix_set_mac(),  */
  1410. + #include <netinet/in.h>        /* struct sockaddr_in */
  1411. + int app_tsix_set_accept_mac( int fd );
  1412. + int app_tsix_set_connect_mac( int fd, struct sockaddr_in * ra);
  1413. + #endif    /* #ifdef _TRUSTED_IRIX */
  1414. + #endif    /* #ifndef _APP_TSIX_H_ */
  1415. + #define IPv6_ENHANCEMENT
  1416. + #ifndef _IRIX_UTIL_H_
  1417. + #define _IRIX_UTIL_H_
  1418. + #include <sys/types.h>
  1419. + #include <sys/socket.h>
  1420. + #include <netinet/in.h>
  1421. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX) 
  1422. + int
  1423. + sendfromto(int fd, void *buf, int buflen, int flags, struct in_addr *from
  1424. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1425. +        , void *to, int tolen
  1426. + #endif    /*#ifdef _USE_ONE_SOCKET_PER_PROTOCOL */
  1427. + #ifdef _TRUSTED_IRIX
  1428. +        , mac_t lbl
  1429. + #endif    /* _TRUSTED_IRIX */
  1430. +     );
  1431. + int
  1432. + recvfromto(int fd, void *buf, int buflen, int flags, struct sockaddr *from,
  1433. +        int fromlen
  1434. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1435. +        , struct in_addr *to
  1436. + #endif    /* _USE_ONE_SOCKET_PER_PROTOCOL */
  1437. + #ifdef _TRUSTED_IRIX
  1438. +        , mac_t *lbl
  1439. + #endif    /* _TRUSTED_IRIX */
  1440. +     );
  1441. + #endif    /*#if defined(_USE_ONE_SOCKET_PER_PROTOCOL)*/
  1442. + #endif    /* #ifndef _IRIX_UTIL_H_ */
  1443.   #include <limits.h>    /* _POSIX_PATH_MAX */
  1444. + #define IRIX_EMUL_IOCTL_SIOCGIFCONF     /* ENBL COMPILATION OF IP ALIAS FIX */
  1445. *** ./port/irix/Makefile    Wed Jun 18 20:22:28 1997
  1446. --- ../src/./port/irix/Makefile    Tue Feb  9 12:33:39 1999
  1447. ***************
  1448. *** 31,37 ****
  1449.   INCL = ${TOP}/include
  1450.   PORTINCL = ${TOP}/port/${SYSTYPE}/include
  1451.   LIBBIND = ${TOP}/lib/libbind.${A}
  1452. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL}
  1453.   LD_LIBFLAGS= -x -r
  1454.   AR= ar cruv
  1455.   RANLIB= :
  1456. --- 31,37 ----
  1457.   INCL = ${TOP}/include
  1458.   PORTINCL = ${TOP}/port/${SYSTYPE}/include
  1459.   LIBBIND = ${TOP}/lib/libbind.${A}
  1460. ! CFLAGS=    ${CDEBUG} -I${PORTINCL} -I${INCL} ${CPPFLAGS}
  1461.   LD_LIBFLAGS= -x -r
  1462.   AR= ar cruv
  1463.   RANLIB= :
  1464. ***************
  1465. *** 57,63 ****
  1466.       ${RANLIB} ${LIBBIND}
  1467.   
  1468.   .c.${O}:
  1469. !     ${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
  1470.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1471.   
  1472.   distclean:: clean
  1473. --- 57,63 ----
  1474.       ${RANLIB} ${LIBBIND}
  1475.   
  1476.   .c.${O}:
  1477. !     ${CC} ${CFLAGS} -c $*.c
  1478.       -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} && ${LDS} mv a.out $*.${O}
  1479.   
  1480.   distclean:: clean
  1481. *** ./port/irix/Makefile.set    Fri Mar 20 16:57:20 1998
  1482. --- ../src/./port/irix/Makefile.set    Tue Feb  9 12:56:52 1999
  1483. ***************
  1484. *** 1,5 ****
  1485. ! 'CC=cc'
  1486. ! 'CDEBUG=-g3 -O2'
  1487.   'DESTBIN=/usr/bin'
  1488.   'DESTSBIN=/usr/sbin'
  1489.   'DESTEXEC=/usr/sbin'
  1490. --- 1,6 ----
  1491. ! 'CC=${TOOLROOT}/usr/bin/cc'
  1492. ! 'CDEBUG=-g3 -O3 -OPT:Olimit=0:space=ON'
  1493. ! 'CPPFLAGS=-nostdinc -I. -I${ROOT}/usr/include -D_BSD_SIGNALS'
  1494.   'DESTBIN=/usr/bin'
  1495.   'DESTSBIN=/usr/sbin'
  1496.   'DESTEXEC=/usr/sbin'
  1497. ***************
  1498. *** 7,12 ****
  1499. --- 8,14 ----
  1500.   'DESTHELP=/usr/lib'
  1501.   'DESTETC=/etc'
  1502.   'DESTRUN=/etc'
  1503. + 'LDFLAGS=-n32 -mips3 -nostdlib -L${ROOT}/usr/lib32 -rpath /usr/freeware/lib32'
  1504.   'LDS=:'
  1505.   'LEX=lex'
  1506.   'YACC=yacc'
  1507. *** ./port/irix/noop.c    Thu Apr 24 14:48:06 1997
  1508. --- ../src/./port/irix/noop.c    Tue Feb  9 13:21:12 1999
  1509. ***************
  1510. *** 1,4 ****
  1511. --- 1,556 ----
  1512. + #include <port_before.h>
  1513. + #include <port_after.h>
  1514.   void
  1515.   __bind_noop() {
  1516.       /* NOOP */
  1517.   }
  1518. + #include <sys/types.h>
  1519. + #include <sys/socket.h>
  1520. + #include <netinet/in.h>
  1521. + #include <sys/uio.h>
  1522. + #include <stdio.h>
  1523. + #ifndef CMSG_FIRSTHDR    /* Include file patch for IRIX 6.2 */
  1524. + #define IP_SENDSRCADDR     36   /* in_addr; send from specified address */
  1525. + #undef msg_control
  1526. + #undef msg_controllen
  1527. + #undef msghdr
  1528. + #define msghdr nmsghdr        /* Redefine in IRIX 6.2 */
  1529. + /* XXX This will become msghdr in the next release */
  1530. + struct nmsghdr {
  1531. +         caddr_t msg_name;               /* optional address */
  1532. +         int     msg_namelen;            /* size of address */
  1533. +         struct  iovec *msg_iov;         /* scatter/gather array */
  1534. +         int     msg_iovlen;             /* # elements in msg_iov */
  1535. +         caddr_t msg_control;            /* ancillary data, see below */
  1536. +         int     msg_controllen;         /* ancillary data buffer len */
  1537. +         int     msg_flags;              /* flags on received message */
  1538. + };
  1539. + /*
  1540. +  * Header for ancillary data objects in msg_control buffer.
  1541. +  * Used for additional information with/about a datagram
  1542. +  * not expressible by flags.  The format is a sequence
  1543. +  * of message elements headed by cmsghdr structures.
  1544. +  */
  1545. + struct cmsghdr {
  1546. +         size_t  cmsg_len;       /* data byte count, including hdr */
  1547. +         int     cmsg_level;     /* originating protocol */
  1548. +         int     cmsg_type;      /* protocol-specific type */
  1549. + /* followed by  u_char  cmsg_data[]; */
  1550. + };
  1551. + #define _ALIGNBYTES     7
  1552. + #define _ALIGN(p)       (((u_int)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
  1553. + /* given pointer to struct cmsghdr, return pointer to data */
  1554. + #define CMSG_DATA(cmsg)         ((u_char *)((cmsg) + 1))
  1555. + /* given pointer to struct cmsghdr, return pointer to next cmsghdr */
  1556. + #define CMSG_NXTHDR(mhdr, cmsg) \
  1557. +         (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \
  1558. +             (mhdr)->msg_control + (mhdr)->msg_controllen) ? \
  1559. +             (struct cmsghdr *)NULL : \
  1560. +             (struct cmsghdr *)((caddr_t)(cmsg) + _ALIGN((cmsg)->cmsg_len)))
  1561. + #define CMSG_FIRSTHDR(mhdr)     ((struct cmsghdr *)(mhdr)->msg_control)
  1562. + #endif    /* #ifndef CMSG_FIRSTHDR */
  1563. + #include "port_before.h"
  1564. + #include <arpa/nameser.h>
  1565. + #include <stdio.h>
  1566. + /*#include "named.h"*/
  1567. + #if defined(_TRUSTED_IRIX)
  1568. + #include <errno.h>        /* oserror(), setoserror() */
  1569. + #include <sys/types.h>        /* mac.h */
  1570. + #include <sys/mac.h>        /* tsix_get_mac(), tsix_set_mac(), 
  1571. +                  * mac_free(), tsix_set_mac_byrhost()
  1572. +                  * tsix_set_solabel()
  1573. +                  */
  1574. + #include <sys/t6net.h>        /* tsix_get_mac(), tsix_set_mac(),
  1575. +                  * tsix_set_mac_byrhost(), tsix_set_solabel()
  1576. +                  */
  1577. + #endif    /* #if defined(_TRUSTED_IRIX) */
  1578. + #include "port_after.h"
  1579. + #if defined(_USE_ONE_SOCKET_PER_PROTOCOL) || defined(_TRUSTED_IRIX) 
  1580. + /* Send messages specifying source address and/or MAC label */
  1581. + int
  1582. + sendfromto(int fd, void *buf, int buflen, int flags
  1583. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1584. +        , struct in_addr *from
  1585. + #endif    /* _USE_ONE_SOCKET_PER_PROTOCOL */
  1586. +        , void *to, int tolen
  1587. + #ifdef _TRUSTED_IRIX
  1588. +        , mac_t lbl
  1589. + #endif    /* _TRUSTED_IRIX */
  1590. + )
  1591. + {
  1592. +     struct msghdr    msg;
  1593. +     struct iovec    iov;
  1594. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1595. +     struct cmsghdr    *cmsg;
  1596. +     char        control[256];
  1597. + #endif    /* _USE_ONE_SOCKET_PER_PROTOCOL */
  1598. +     
  1599. +     iov.iov_len = buflen;
  1600. +     iov.iov_base = buf;
  1601. +     
  1602. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1603. +     if (from && from->s_addr) {
  1604. +     cmsg = (struct cmsghdr *)control;
  1605. +     cmsg->cmsg_type = IP_SENDSRCADDR;
  1606. +     cmsg->cmsg_level = IPPROTO_IP;
  1607. +     cmsg->cmsg_len = sizeof(*cmsg) + sizeof(struct in_addr);
  1608. +     bcopy(from, cmsg + 1, sizeof(struct in_addr));
  1609. +     msg.msg_controllen = cmsg->cmsg_len;
  1610. +     msg.msg_control = control;
  1611. +     } else {
  1612. +     msg.msg_controllen = 0;
  1613. +     msg.msg_control = (void *)0;
  1614. +     }
  1615. + #else    /* _USE_ONE_SOCKET_PER_PROTOCOL */
  1616. +     msg.msg_controllen = 0;
  1617. +     msg.msg_control = (void *)0;
  1618. + #endif    /* _USE_ONE_SOCKET_PER_PROTOCOL */
  1619. +     
  1620. +     msg.msg_namelen = tolen;
  1621. +     msg.msg_name = to;
  1622. +     msg.msg_iovlen = 1;
  1623. +     msg.msg_iov = &iov;
  1624. +     
  1625. + #ifdef _TRUSTED_IRIX
  1626. +     if (tsix_set_mac(fd, lbl) == -1) {
  1627. +     return -1;
  1628. +     }
  1629. + #endif    /* _TRUSTED_IRIX */
  1630. +     
  1631. +     return sendmsg(fd, &msg, flags);
  1632. + }/* int sendfromto() */
  1633. + /* Recives messages recording receiving interface and/or MAC label */
  1634. + int
  1635. + recvfromto(int fd, void *buf, int buflen, int flags, struct sockaddr *from,
  1636. +        int fromlen
  1637. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1638. +        , struct in_addr *to
  1639. + #endif    /* _USE_ONE_SOCKET_PER_PROTOCOL */
  1640. + #ifdef _TRUSTED_IRIX
  1641. +        , mac_t *lbl
  1642. + #endif    /* _TRUSTED_IRIX */
  1643. +     )
  1644. + {
  1645. +     
  1646. +     int            status;
  1647. +     struct msghdr    msg;
  1648. +     struct iovec    iov;
  1649. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1650. +     struct cmsghdr    *cmsg;
  1651. +     char        control[256];
  1652. + #endif    /* _USE_ONE_SOCKET_PER_PROTOCOL */    
  1653. +     iov.iov_len = buflen;
  1654. +     iov.iov_base = buf;
  1655. +     
  1656. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1657. +     bzero(control, sizeof(control));
  1658. + #endif    /* _USE_ONE_SOCKET_PER_PROTOCOL */
  1659. +     
  1660. +     msg.msg_namelen = fromlen;
  1661. +     msg.msg_name = (caddr_t)from;
  1662. +     msg.msg_iovlen = 1;
  1663. +     msg.msg_iov = &iov;
  1664. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1665. +     msg.msg_controllen = sizeof(control);
  1666. +     msg.msg_control = control;
  1667. + #else
  1668. +     msg.msg_controllen = 0;
  1669. +     msg.msg_control = (void *)0;
  1670. + #endif    /* _USE_ONE_SOCKET_PER_PROTOCOL */
  1671. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1672. +     if (to) {
  1673. +     
  1674. +     bzero(to, sizeof(struct in_addr));
  1675. +     }
  1676. + #endif    /* _USE_ONE_SOCKET_PER_PROTOCOL */
  1677. +     status = recvmsg(fd, &msg, flags);
  1678. +     
  1679. +     if (status > 0) {
  1680. +     
  1681. + #ifdef _TRUSTED_IRIX    
  1682. +     
  1683. +     /* Get MAC label for source of message
  1684. +      * SHOULDN'T THIS CALL BE BEFORE recvmsg()?
  1685. +      * 
  1686. +      */
  1687. +     
  1688. +     status = ((tsix_get_mac(fd, lbl) == 0) ? status : -1);
  1689. + #endif    /* _TRUSTED_IRIX */    
  1690. +     
  1691. + #ifdef _USE_ONE_SOCKET_PER_PROTOCOL
  1692. +     
  1693. +     /* Get the 'to' or target address for current message */
  1694. +     if (to) {
  1695. +     
  1696. +         for (cmsg = CMSG_FIRSTHDR(&msg); cmsg;
  1697. +          cmsg = CMSG_NXTHDR(&msg, cmsg)) {
  1698. +         
  1699. +         if (cmsg->cmsg_level == IPPROTO_IP &&
  1700. +             cmsg->cmsg_type == IP_RECVDSTADDR) {
  1701. +             
  1702. +             bcopy(CMSG_DATA(cmsg), to, sizeof(struct in_addr));
  1703. +             
  1704. +         }
  1705. +         
  1706. +         }/* for() */
  1707. +         
  1708. +     }/* if (to) */
  1709. + #endif /* _USE_ONE_SOCKET_PER_PROTOCOL */    
  1710. +     }/* if (status > 0) */
  1711. +     return status;
  1712. +     
  1713. + }/* int recvfromto() */
  1714. + #endif    /*#if defined(_USE_ONE_SOCKET_PER_PROTOCOL)*/
  1715. + #ifdef _TRUSTED_IRIX
  1716. + /* Set the outgoing MAC label of a socket that was created through the
  1717. +  * accept() call to the MAC label of the connecting node.
  1718. +  */
  1719. + int 
  1720. + app_tsix_set_accept_mac( int fd )
  1721. + {
  1722. +     
  1723. +     int        error;        /* Preserve error code */
  1724. +     mac_t    mac_lbl;
  1725. +     
  1726. +         
  1727. +     if (fd >= 0)
  1728. +     {
  1729. +     
  1730. +     /* Set MAC on fd to that of the connecting entity */
  1731. +     
  1732. +     if ( (tsix_on(fd) == -1)\
  1733. +          || (tsix_get_mac(fd, &mac_lbl) == -1))
  1734. +     {
  1735. +         
  1736. +         return -1;
  1737. +         
  1738. +     }
  1739. +     else if (tsix_set_mac(fd, mac_lbl) == -1)
  1740. +     {
  1741. +         
  1742. +         error = oserror();
  1743. +         mac_free(mac_lbl);
  1744. +         setoserror( error );
  1745. +         return -1;        
  1746. +         
  1747. +     } 
  1748. +     else
  1749. +     {
  1750. +         
  1751. +         mac_free(mac_lbl);
  1752. +         
  1753. +         /* This tsix_off() was used in the previous version of Bind.
  1754. +          * I have taken it out because according to the man pages it
  1755. +          * will stop trusted operation on the socket.
  1756. +          */
  1757. +         /*         if (tsix_off(fd) == -1) { */
  1758. +         /*         return -1; */
  1759. +         /*         } */
  1760. +         
  1761. +     }
  1762. +     return 0;
  1763. +     } 
  1764. +     else
  1765. +     {
  1766. +     return -1;    /* Invalid file descriptor! */
  1767. +     }
  1768. +     
  1769. + }/* int app_tsix_set_accept_mac() */
  1770. + /* Set the MAC label of a socket to be connected to a given remote address */
  1771. + int 
  1772. + app_tsix_set_connect_mac( int fd, struct sockaddr_in * ra)
  1773. + {
  1774. +     mac_t    mac_lbl;
  1775. +     /* 
  1776. +      * Set MAC label of all outgoing comm and the socket to default
  1777. +      * remote MAC label.
  1778. +      *
  1779. +      * NOTE: IF THIS GETS CALLED MORE THAN ONCE FOR THE SAME 
  1780. +      * SOCKET YOU MAY NEED TO SET MAC ONLY THE FIRST TIME THROUGH.
  1781. +      * 
  1782. +      * First enable trusted operation on the socket (tsix_on()), then 
  1783. +      * set MAC label of all outgoing info on the socket to the default for
  1784. +      * remote host, and finally, set MAC label of the socket itself.
  1785. +      * NOT SURE IF tsix_set_solabel() DOES THE SAME AS 
  1786. +      * tsix_set_mac_byrhost(), THE MAN PAGES DO NOT HELP IN CLEARING THIS.
  1787. +      *
  1788. +      */
  1789. +     if ( ((tsix_on( fd ) == -1)\
  1790. +       || (tsix_set_mac_byrhost(fd, &(ra->sin_addr), &mac_lbl) == -1)\
  1791. +       || (tsix_set_solabel(fd, mac_lbl) == -1)) )
  1792. +     {
  1793. +     
  1794. +     return -1;
  1795. +     }
  1796. +     return 0;
  1797. +       
  1798. + }/*int app_tsix_set_connect_mac() */
  1799. + #endif    /* #ifdef _TRUSTED_IRIX */
  1800. + /* This fucntion is used to emulate ioctl( SIOCGIFCONF ) in IRIX so that
  1801. +  * it will behave like in most UNIX systems returning an entry for each 
  1802. +  * IP interface. This fixes the IP aliasing problem in IRIX.
  1803. +  * The sysctl system call is used to retrieve the interface info which is
  1804. +  * the transfered to the ifconf structure returned by ioctl().
  1805. +  * 
  1806. +  * File: emul_ioctl.c
  1807. +  * By: gomez@cs.purdue.edu
  1808. +  * Date: 11/02/98
  1809. +  * 
  1810. +  */
  1811. + /* Enable if you want interfaces that are down to be ignored */
  1812. + /* #define _IGNORE_DOWN_IFACES */
  1813. + #include <stdio.h>        /* NULL */
  1814. + #include <sys/types.h>
  1815. + #include <sys/sysctl.h>        /* sysctl() */
  1816. + #include <sys/socket.h>        /* sysctl(), struct sockaddr */
  1817. + #include <stdlib.h>        /* malloc() */
  1818. + #include <net/route.h>        /* RTM_* */
  1819. + #include <net/if_dl.h>        /* struct sockaddr_dl */
  1820. + #include <string.h>        /* memcpy(), memset() */
  1821. + #include <errno.h>        /* setoserror() */
  1822. + #define ROUNDUP( sz ) (( (sz) > 0 ) ?\
  1823. +             ( 1 + (((sz) - 1) | (sizeof(__uint64_t) - 1))) :\
  1824. +             0)
  1825. + #ifdef _HAVE_SA_LEN
  1826. + #define ADVANCE( ptr, sa ) ptr += ROUNDUP( (sa)->sa_len ) 
  1827. + #else
  1828. + #define ADVANCE( ptr, sa ) ptr += ROUNDUP( _FAKE_SA_LEN_DST(sa) ) 
  1829. + #endif
  1830. + int
  1831. + emul_ioctl( struct ifconf * ifc )
  1832. + {
  1833. +     size_t        bufsz, used_sz;
  1834. +     char        *buf, *ptr, *end_ptr;
  1835. +     int            mib[6] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0 };
  1836. +     struct if_msghdr    *ifmsghdr;        /* Iface info */
  1837. +     struct ifa_msghdr    *ifamsghdr;        /* Iface address info */
  1838. +     char        if_name[IFNAMSIZ];    /* Interface name */
  1839. +     struct sockaddr_dl    *if_addr;        /* Interface name struct */
  1840. +     char        *addr_ptr;        /* Next address */
  1841. +     struct ifreq    *ifreq_ptr;        /* current ifreq */
  1842. +     struct sockaddr    *curr_addr;
  1843. +     /* Check parameter */
  1844. +     if ( (ifc == NULL) || (ifc->ifc_len <= 0) || (ifc->ifc_buf == NULL) )
  1845. +     {
  1846. +     setoserror(EINVAL);
  1847. +     return -1;
  1848. +     }
  1849. +     /* Get size of buffer needed */
  1850. +     if (sysctl(mib, 6, NULL, &bufsz, NULL, 0) < 0)
  1851. +     {
  1852. +     return -1;
  1853. +     }
  1854. +     /* Allocate memmory and retrieve info */
  1855. +     if ((buf = malloc(bufsz)) == NULL)
  1856. +     {
  1857. +     return -1;
  1858. +     
  1859. +     }
  1860. +     
  1861. +     if (sysctl(mib, 6, buf, &bufsz, NULL, 0) < 0)
  1862. +     {
  1863. +     
  1864. +     return -1;
  1865. +     }
  1866. +     /* Place info in ifconf structure */
  1867. +     for ( ptr = buf, end_ptr = buf + bufsz, if_name[0] = '\0', used_sz = 0,\
  1868. +           ifreq_ptr = (struct ifreq *)(ifc->ifc_buf);\
  1869. +       ptr < end_ptr;\
  1870. +       ptr += ifmsghdr->ifm_msglen )
  1871. +     {
  1872. +     
  1873. +     ifmsghdr = (struct if_msghdr *)ptr;
  1874. +     if ( ifmsghdr->ifm_type == RTM_IFINFO )
  1875. +     {
  1876. +         memset( if_name, 0, IFNAMSIZ );
  1877. +         /* We only get interface name from this message */
  1878. +         if ( ifmsghdr->ifm_addrs & RTA_IFP )
  1879. +         {
  1880. + #ifdef _IGNORE_DOWN_IFACES
  1881. +         if (!(IFF_UP & ifcmsghdr->ifm_flags))
  1882. +         {
  1883. +             
  1884. +             /* Skip if iface is down */
  1885. +             continue;
  1886. +             
  1887. +         }
  1888. + #endif
  1889. +         
  1890. +         if_addr = (struct sockaddr_dl *)(ifmsghdr + 1);
  1891. +         memcpy( if_name, if_addr->sdl_data,\
  1892. +             MIN( (size_t)(if_addr->sdl_nlen), IFNAMSIZ ) );
  1893. +         }/* if ( ifmsghdr->ifm_addrs & RTA_IFP ) */
  1894. +     }
  1895. +     else if ( ifmsghdr->ifm_type == RTM_NEWADDR )
  1896. +     {
  1897. +         if ( if_name[0] == '\0' )
  1898. +         {
  1899. +         /* No iface name for this address ignore */
  1900. +         continue;
  1901. +         }
  1902. +         /* Here we get the address info and create an entry in ifc */
  1903. +         ifamsghdr = (struct ifa_msghdr *)ptr;    /* Correct format */
  1904. +         addr_ptr = (char *)(ifamsghdr + 1);
  1905. +         curr_addr= (struct sockaddr *)addr_ptr;
  1906. +         if ( ifamsghdr->ifam_addrs & RTA_NETMASK )
  1907. +         {
  1908. +         /* Mask address present, skip it */
  1909. +         ADVANCE( addr_ptr, curr_addr );
  1910. +         curr_addr = (struct sockaddr *)addr_ptr;
  1911. +         }/* if ( ifamsghdr->ifam_addrs & RTA_NETMASK ) */
  1912. +         if ( ifamsghdr->ifam_addrs & RTA_IFA )
  1913. +         {
  1914. +         /* Get interface address and create ifc entry */
  1915. +         used_sz += sizeof(struct ifreq);
  1916. +         if ( used_sz > ifc->ifc_len )
  1917. +         {
  1918. +             /* Return whatever we were able to retrieve with given
  1919. +              * buffer.
  1920. +              */
  1921. +             ifc->ifc_len = used_sz - sizeof(struct ifreq);
  1922. +             setoserror( ENOMEM );
  1923. +             return -1;
  1924. +         }
  1925. +         
  1926. +         memcpy( ifreq_ptr->ifr_name, if_name, IFNAMSIZ );
  1927. + #ifdef _HAVE_SA_LEN
  1928. +         memcpy( &(ifreq_ptr->ifr_addr), curr_addr, curr_addr->sa_len );
  1929. + #else
  1930. +         memcpy( &(ifreq_ptr->ifr_addr), curr_addr,\
  1931. +             _FAKE_SA_LEN_DST(curr_addr));
  1932. + #endif
  1933. +         ifreq_ptr++;
  1934. +         
  1935. +         }
  1936. +              
  1937. +     }
  1938. +     
  1939. +     /* The RTM_DELADDR message is ignored */
  1940. +     
  1941. +     }/* for ( ptr = buf, end_ptr = buf + bufsz, if_name[0] = '\0',...) */
  1942. +     ifc->ifc_len = used_sz;
  1943. +     
  1944. +     return 0;
  1945. + }/* int emul_ioctl() */
  1946.